From: Krinkle Date: Mon, 1 Nov 2010 15:32:51 +0000 (+0000) Subject: Follow-up r75762 X-Git-Tag: 1.31.0-rc.0~34152 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=5b5198a86263412cb5488b6493a68969f5137c1e;p=lhc%2Fweb%2Fwiklou.git Follow-up r75762 --- diff --git a/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js b/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js index 2b272b0993..e492c77a3f 100644 --- a/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js +++ b/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js @@ -1,19 +1,22 @@ /* * JavaScript to enable right click edit functionality */ +$( function() { -// Select all h1-h6 elements that contain editsection links -$('h1, h2, h3, h4, h5, h6').filter( ':has(.editsection a)' ).bind( 'contextmenu', function( e ) { + // Select all h1-h6 elements that contain editsection links + $('h1:has(.editsection a), h2:has(.editsection a), h3:has(.editsection a), h4:has(.editsection a), h5:has(.editsection a), h6:has(.editsection a)').live( 'contextmenu', function( e ) { - // Get href of the [edit] link - var href = $(this).find( '.editsection a' ).attr( 'href' ); + // Get href of the [edit] link + var href = $(this).find( '.editsection a' ).attr( 'href' ); - // Check if target is the anchor link itself. If so, dont supress the contextmenu - // So that the reader can still do things like copy url, open in new tab etc. - $target = $( e.target ); - if( !$target.is( 'a' ) && !$target.parent().is( '.editsection' ) ){ - window.location = href; - e.preventDefault(); - } + // Check if target is the anchor link itself. If so, dont supress the contextmenu + // So that the reader can still do things like copy url, open in new tab etc. + $target = $( e.target ); + if( !$target.is( 'a' ) && !$target.parent().is( '.editsection' ) ){ + window.location = href; + e.preventDefault(); + } + + }); }); \ No newline at end of file